//
//  HJChatMessageTextCell.m
//  XWC
//
//  Created by Hello on 2022/10/25.
//

#import "HJChatMessageTextCell.h"
#import "HJChatMessageTextLayout.h"
#import "HJChatMessageModel.h"

@interface HJChatMessageTextCell()

@property (nonatomic, strong) HJChatMessageTextLayout *textLayout;

@end


@implementation HJChatMessageTextCell 


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        UILabel *contentLabel = [UILabel addToView:self.bubbleView];
        contentLabel.textAlignment = NSTextAlignmentLeft;
        contentLabel.numberOfLines = 0;
        _contentLabel = contentLabel;
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    _contentLabel.frame = self.textLayout.contentRect;
}

- (void)setMessageLayout:(HJChatMessageLayout *)messageLayout {
    [super setMessageLayout:messageLayout];
    
    self.textLayout = (HJChatMessageTextLayout *)messageLayout;
    self.contentLabel.font = self.textLayout.textFont;
    self.contentLabel.attributedText = self.textLayout.attributedString;


}

@end
